Sol[n] writes n as a sum of numbers whose only prime factors are 2 and 3 and which are not divisible by each other.

Clear[Sol];
Sol[0] = {};
Sol[n_] /; EvenQ[n] := Sol[n]=2Sol[n/2];
Sol[n_] /; OddQ[n] := Sol[n] = Module[{p},
p=3^Floor[Log[3, n]];
Prepend[Sol[n-p], p]
]

Sol[513]

Max[Length /@ (Sol /@ Range[10000]) ]

Position[Length /@ (Sol /@ Range[10000]), 8]

Sol[6305]

IntegerDigits[6433, 6]